package kr.co.redcircle.broker.io;

import java.util.HashMap;

import kr.co.redcircle.broker.Broker;
import net.sf.json.JSONObject;

public class BrokerResponse extends HashMap<String, Object> implements IDefaultIO {

	private static final long serialVersionUID = 7071190427408569280L;
	private String respJSON;
	private IHandler handler;
	
	public BrokerResponse() {
		super();
		this.put(Broker.RESULT_FLAG, true);
	}

	public BrokerResponse(String requestStr) {
		respJSON = JSONObject.fromObject(requestStr).toString();
	}

	public void setHandler(IHandler respHandler) {
		this.handler = respHandler;
	}

	@Override
	public String getHandler() {
		return (String) this.get(Broker.HANDLER);
	}

	@Override
	public String toString() {
		return JSONObject.fromObject(this).toString();
	}

}
